Skip to content

Conversation

@thanosan23
Copy link

Added connection to Mantis Extensions to allow for GitHub space creation

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @thanosan23, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request adds a new connection to Mantis Extensions that allows for the creation of GitHub spaces. It introduces the octokit library to fetch commit data from GitHub repositories, including commit messages, authors, dates, links, and diffs. This data is then used to create a Mantis space, which is injected into the GitHub repository content area as an iframe. The PR also includes minor UI tweaks to improve the appearance of the connection dialog.

Highlights

  • GitHub Connection: Adds a new connection to Mantis Extensions for creating spaces from GitHub repositories.
  • Dependency: octokit: Introduces the octokit library to fetch commit data from GitHub.
  • Data Extraction: Extracts commit messages, authors, dates, links, and diffs from GitHub repositories.
  • UI Injection: Injects the created Mantis space into the GitHub repository content area as an iframe.
  • UI Tweaks: Includes minor UI tweaks to improve the appearance of the connection dialog.

Changelog

Click here to see the changelog
  • .env
    • Added PLASMO_PUBLIC_GITHUB_REDIRECT_URI and PLASMO_PUBLIC_GITHUB_AUTH variables for GitHub authentication.
    • Commented out PLASMO_PUBLIC_GITHUB_CLIENT_ID and PLASMO_PUBLIC_GITHUB_CLIENT_SECRET as their usage is still being determined.
  • package.json
    • Added octokit as a dependency.
  • plasmo.config.ts
    • No significant changes.
  • src/connections/github/connection.tsx
    • Implemented the GitHubConnection component to fetch commit data and create Mantis spaces.
    • Uses octokit to retrieve commit information, including messages, authors, dates, links, and diffs.
    • Injects the created Mantis space into the GitHub repository content area as an iframe.
    • Includes functions to trigger the connection based on the URL and to create the space with extracted data.
  • src/content.tsx
    • Updated the text color of the connection name, counter, and note text in the connection dialog to black.
  • src/driver.tsx
    • Added GitHubConnection to the list of available connections.
  • yarn.lock
    • Updated dependencies, including adding octokit and its related dependencies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

The name 'Octokit' is a play on words, combining 'Octo' (referring to GitHub's Octocat mascot) and 'Kit' (referring to a set of tools or library).

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new connection to Mantis Extensions for GitHub space creation. The changes include adding necessary dependencies, configuring environment variables, and implementing the connection logic. Overall, the code seems well-structured, but there are a few areas that could be improved for clarity and security.

Summary of Findings

  • Environment Variable Security: Storing the GitHub authentication token directly in the .env file is not secure, especially for a client-side application. This exposes the token to potential vulnerabilities. Consider using a more secure method for handling authentication, such as OAuth flow or storing the token securely on the server-side.
  • Error Handling: The error handling in the createSpace function could be improved. Currently, it catches errors during the diff retrieval but simply assigns "Diff unavailable". Consider logging the error or providing more informative feedback to the user.
  • Magic Numbers: The scale variable in the injectUI function is a magic number. It would be better to define it as a constant with a descriptive name.

Merge Readiness

The pull request introduces a significant new feature. However, due to the high severity security concern regarding the storage of the GitHub authentication token, I recommend addressing this issue before merging. Additionally, addressing the error handling and magic number issues would improve the overall quality of the code. I am unable to approve this pull request, and users should have others review and approve this code before merging.

@thanosan23 thanosan23 requested a review from LucaVor March 12, 2025 19:33
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new GitHub connection to the Mantis extension, allowing users to create spaces based on GitHub repository commits. The changes include adding necessary dependencies, configuring environment variables, implementing the GitHub connection logic, and updating the UI to support the new connection. There are a few suggestions for code improvements, such as using import instead of require, adding descriptive comments, using object destructuring, and removing debugging statements.


import githubIcon from "data-base64:../../../assets/github.png";
import { getSpacePortal, registerAuthCookies, reqSpaceCreation } from "../../driver";
const { Octokit } = require("@octokit/core");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's generally recommended to use import instead of require for better readability and consistency in modern JavaScript/TypeScript code.

Suggested change
const { Octokit } = require("@octokit/core");
import { Octokit } from "@octokit/core";

</button>
<div className="flex-grow" />
<span className="text-gray-600">
<span className="text-black-600">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This class name text-black-600 does not exist in tailwind, did you mean text-gray-600 or text-black?

                    <span className="text-gray-600">

@gconsigli gconsigli self-requested a review July 15, 2025 00:43
@gconsigli
Copy link
Contributor

gconsigli commented Jul 15, 2025

Thanks so much for this work @thanosan23 and @aryanahou! I'll be reviewing this PR over the next few days to make sure everything is working.

Copy link
Contributor

@gconsigli gconsigli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just finished my review! I tested this integration on my end for errors and usability. I ran into a few issues on my end with running the integration - I'm not sure if that was because I was using the wrong scopes/GitHub PAT. We might just need to change the logic of the backend with recent changes to space creation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this extension will be published to the Chrome Web Store, can you make a settings page that lets users add their OpenAI API key and GitHub token to use the GitHub integration? Possibly settings that can be added to the GitHub space creation popup:

image

Make sure that this also includes details about the type of GitHub PAT needed and what scopes should be enabled (fine-grained or classic)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this image might be broken. If it's not used, can you delete it?

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I try creating a space using this integration, I'm getting the following errors:

github.com/orgoruser/reponame pages:

image

Non github.com/orgoruser/reponame pages:

image

I'm not sure if this integration is meant to only be run on the main page of a repo, but if it is, can you make it so the button only shows up on valid repository URLs?

@ArjunS7864 ArjunS7864 self-assigned this Jul 20, 2025
@ArjunS7864 ArjunS7864 removed their assignment Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants